package com.scala.oop.triat

/**
 * Created by Administrator on 2018/1/28/028.
 * //trait里定义有实现方法
 *
 */
trait Logger {
  def log(log:String): Unit ={
    println("log:"+log)
  }
}

class Hello(val name:String)extends Logger {
  def sayHello(): Unit ={
    println("hello "+ name)
    log("this is sayhello function")
  }
}

object test{
  def main(args: Array[String]) {
    val h = new Hello("leo")
    h.sayHello
  }
}